from typing import List


class Solution:
    def kthCharacter(self, k: int, operations: List[int]) -> str:
        def mapping(c):
            if c == 'z': return 'a'
            return chr(ord(c) + 1)

        def build(k, op_id):
            if k == 1: return 'a'
            if operations[op_id] == 0:
                return build(k - (1 << (k.bit_length() - 1)), op_id - 1)
            return mapping(build(k - (1 << (k.bit_length() - 1)), op_id - 1))

        return build(k, k.bit_length() - 1)


if __name__ == '__main__':
    s = Solution()
    r = s.kthCharacter(11, [0, 0, 1, 1])
    print(r)
